<!DOCTYPE html>
<html lang="en">
<head>
<title>模块安装卸载</title>
    <?php $this->load->module('admin/index/page_header');?>
</head>
<body>
<div id="mainContent" class="wrap">
    <div id="content" class="table_full">
		<div class="h_a">说明</div>
			<div class="prompt_text">
			<ul>
				<li>模块管理可以很好的扩展网站运营中所需功能！</li>
				<li><font color="#FF0000">获取更多模块请到官方网站模块扩展中下载安装！安装非官方发表模块需谨慎，有被清空数据库的危险！</font></li>
				<li>官网地址：<font color="#FF0000">http://www.66diqiu.com</font>，<a href="http://www.66diqiu.com" target="_blank">立即前往</a>！</li>
			</ul>
		</div>
        <div class="h_a">可用模块</div>
		<table width="100%" data-uri="<?php echo site_url('admin/adminuser/ajax_status');?>">
      <colgroup>
		      <col width="120">
	      <col>
		      <col width="150">
		      <col width="120">
      </colgroup>
      <thead>
        <tr>
	          <th>应用图标</th>
	          <th>应用介绍</th>
	          <th>安装时间</th>
	          <th>操作</th>
        </tr>
      </thead>
      <?php foreach($module_list as $key=>$val):?>
      <tr>
        <td>
            <div class="app_icon">
                <img src="<?php echo $val['icon'];?>" alt="模块管理" width="80" height="80">
            </div>
        </td>
        <td valign="top">
            <h3 class="mb5 f12"><a target="_blank" href="http://www.66diqiu.com"><?php echo $val['modulename'];?></a></h3>
            <div class="mb5">
	            <span class="mr15">版本：<b><?php echo $val['version'];?></b></span> 
	            <span>开发者：<a target="_blank" href="<?php echo $val['authorsite'];?>"><?php echo $val['author'];?></a></span>
	            <span>适配 66diqiu 最低版本：<?php echo $val['adaptation'];?></span>
            </div>
            <div class="gray"><?php echo $val['introduce']?></div>
            <div><span class="mr20"><a href="http://www.66diqiu.com" target="_blank">http://www.66diqiu.com</a></span></div>
        </td>
	        <td><?php if(isset($val['install_time'])):?> <?php echo $val['install_time']?> <?php else:?>/<?php endif;?></td>
	        <td>
        <?php if(isset($val['install_time'])):?>
	        <input type="button" data-uri="<?php echo $val['uninstall_url'];?>" class="btn btn_submit mr5 uninstall" value="卸载" data-status="0" /> 
        <?php else:?>
	        <input type="button" data-uri="<?php echo $val['install_url'];?>" class="btn btn_submit mr5 install" value="安装" data-status="1" /> 
	        
        <?php endif;?>
        </td>
      </tr>
      <?php endforeach;?>
      </table>
		<div class="page_nav">
		<?php echo $this->mypageclass->show(1); ?>
		</div>
    </div>
</div>
<script type="text/javascript">
$(function(){
    /**
     * 模块安装卸载操作
     */
    $(".install,.uninstall").click(function(){
        var uri = $(this).attr("data-uri");
        var msg = $(this).attr("data-status")==0?'你确认要卸载此模块么?卸载了数据会丢失。':'你确认要安装此模块么?';
        var that = this;
        $.dialog.confirm(msg, function () {
            $.ajax({
                url:uri,
                cache:false,
                dataType:'json',
                type:'POST',
                data:{},
                success:function(msgObj){
                	if(msgObj.status==1){
	                	if(msgObj.status==1){
                            $.dialog.tips(msgObj.info);
		                	window.location.href=msgObj.url;
	                	}else{
                            $.dialog.alert(msgObj.info);
	                	}		
                	}else{
                        $.dialog.alert(msgObj.info);
                	}
                    return false;
                }
            });
        }, function () {
        });
    });	
})
</script>
</body>
</html>